﻿using JaxDug.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace JaxDug.Areas.CodeCamp.Controllers
{
    public partial class AttendeeController : Controller
    {
        //
        // GET: /CodeCamp/Attendee/

        public virtual ActionResult Index()
        {
            return View();
        }

        public virtual ActionResult Registration()
        {
            //JaxdugEntities db = new JaxdugEntities();
            JaxDug.Areas.CodeCamp.Models.Attendee attendeeModel = new JaxDug.Areas.CodeCamp.Models.Attendee();
            return View(attendeeModel);
        }

        [HttpPost]
        public virtual ActionResult Registration(JaxDug.Areas.CodeCamp.Models.Attendee attendeeModel)
        {
            JaxdugEntities db = new JaxdugEntities();
            Attendee attendeeEntity = new Attendee();
            attendeeEntity.DateCreated = DateTime.Now;
            attendeeEntity.FirstName = attendeeModel.FirstName;
            attendeeEntity.LastName = attendeeModel.LastName;
            attendeeEntity.Email = attendeeModel.Email;
            attendeeEntity.ShirtSize = attendeeModel.ShirtSize;
            db.Attendees.AddObject(attendeeEntity);
            db.SaveChanges();

            return View("ThankYouForRegistering");
        }

    }
}
